set the visible of field 1 to false -- background field
set the scroll of card field 1 to 0
set the scroll of card field 2 to 0
end opencard
on closecard
set the visible of field 1 to true
end closecard
-- part 2 (field)
-- low flags: 00
-- high flags: 4007
-- rect: left=384 top=62 right=290 bottom=491
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: scroller
-- part 3 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=76 top=298 right=320 bottom=176
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: XScrollBox
----- HyperTalk script -----
on mouseUp
put empty into msg
get XScrollBox(2,"Choose one of these:",card field "scroller","Help")
if it is "Help" then
put "You pushed the 'Help' button."
else if it is empty then
put "You pushed the 'Cancel' button."
else
put "Your choice was: " & it
end if
end mouseUp
-- part 5 (field)
-- low flags: 00
-- high flags: 2007
-- rect: left=18 top=32 right=290 bottom=384
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 20
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: XCMD Text
-- part 6 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=304 top=299 right=321 bottom=425
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show LSC Source
----- HyperTalk script -----
on mouseUp
get the visible of card field "source"
set the visible of card field "source" to not it
if it is false then
set the name of me to "Hide LSC Source"
else
set the name of me to "Show LSC Source"
end if
end mouseUp
-- part 7 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=18 top=31 right=290 bottom=489
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: source
-- part contents for card part 2
----- text -----
able
baker
charlie
dog
ernest
fox
gamma
horse
ice cream
jumping jack flash
knockwurst
liver
monkey
no way, jose
occularity
penelope
qwerty
rapscallion
salubrious
twinkle toes
underwhelmed
vermin
wascally wabbit
yokel
zenzational
-- part contents for card part 5
----- text -----
XScrollBox version 1.4
Roger Brown
XScrollBox is a HyperCard XFCN that creates a scrolling selection dialog box from any multi-lined container. Each line of the container is made into a selection line in the dialog. Only one line can be selected.
The return value has two items: the number of the selection and the text of the selection. These are separated by commas as in normal HyperCard format.
Selection can be made by :
1. double-clicking on a line.
2. single-clicking on a line, then pressing the OK button.
3. single-clicking on a line, then pressing the Return key.
4. typing the first letter(s) of a selection, then doing 1,2, or 3.
(Note: type selection assumes that the lines are ordere alphabetically)
5. scrolling with up and down arrow keys, then doing 1,2 or 3.
If the Cancel button is pressed, a null string is returned.
It requires that the DITL and DLOG resources (1345) packaged with
it are in the stack.
The dialog is centered on the screen and sized to hold the width of the
longest line and/or the prompt line, whichever is widest. It will not
overrun the width of a Mac+ screen.
INVOKING XScrollBox
get XScrollBox(first,prompt,container,userButton)
where first is a default selection in the list - either a number or a
text string (0 if none).
prompt is a string to prompt the user. This appears at the top
of the dialog box.
container is any hypercard container (field, variable),
presumed to be multi-lined.
UserButton is the name for an optional author specified
button. If this button is pressed, its name is returned
further processing by the script.
EXAMPLE
ex. get XScrollBox(1,"Choose:",card field 1,"Help")
if OK is pressed, returns : 1,text of line 1 of card field 1
REVISION HISTORY
1.1 center dialog box on any size screen
1.2 - add selection scrolling by typing and by cursor keys